<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="分配的线索" name="distrcus">
        <cus-list ref="distrcus" category="CC" list_type="distrcus" scope="1" />
      </el-tab-pane>
      <el-tab-pane label="三天内未跟进的线索" name="not3daycus">
        <cus-list ref="not3daycus" category="CC" list_type="not3daycus" scope="1" />
      </el-tab-pane>
      <el-tab-pane label="今日已联系线索" name="todayusecus">
        <cus-list ref="todayusecus" category="CC" list_type="todayusecus" scope="1" />
      </el-tab-pane>
      <el-tab-pane label="今日需联系线索" name="todayneedcus">
        <cus-list ref="todayneedcus" category="CC" list_type="todayneedcus" scope="1" />
      </el-tab-pane>
      <el-tab-pane label="归档:我的线索" name="mycus">
        <cus-list ref="mycus" category="CC" list_type="mycus" scope="1" />
      </el-tab-pane>
      <el-tab-pane label="归档:下属的线索" name="subcus">
        <cus-list ref="subcus" category="CC" list_type="subcus" scope="2" />
      </el-tab-pane>
      <!--      <el-tab-pane label="部门线索" name="deptcus">-->
      <!--        <cus-list ref="deptcus" category="CC" list_type="deptcus" />-->
      <!--      </el-tab-pane>-->
      <el-tab-pane v-if="isAll" label="全部线索" name="allcus">
        <cus-list ref="allcus" category="CC" list_type="allcus" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import CusList from "../components/cuslist.vue";
import { getRole } from "@/utils/auth";
export default {
  components: {
    CusList
  },
  data() {
    return {
      activeName: "distrcus",
      isAll: false
    };
  },
  created() {
    this.isAll = getRole().some(item => item.admin);
  },
  methods: {
    handleClick(tab) {
      this.$refs[tab.name].getList();
      this.$refs[tab.name].customerStatus();
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
